distance set algorithm: aSIFSTime = aRxRFDelay + aRxPLCPDelay + aMACProcessingDelay + aRxTxTurnaroundTime aSlotTime = aCCATime + aRxTxTurnaroundTime + aAirPropagationTime + aMACProcessingDelay PIFS = aSIFSTime + aSlotTime DIFS = aSIFSTime + 2 × aSlotTime cck: aPreambleLength 144 μs aPLCPHeaderLength 48 μs ofdm: FULL HALF QUARTER aPreambleLength 16 μs 32 μs 64 μs aPLCPHeaderLength 4 μs 8 μs 16 μs IEEE 802.11-2007 9.2.10: EIFS = aSIFSTime + DIFS + ACKTxTime: ACKTxTime = aPreambleLength + aPLCPHeaderLength + txtime_of_14bytes ofdma_eifs = 16 + (16 + (2 * 9) + (16 + 4 + 20) (90) hal value 92 ofdmg_eifs = 16 + (16 + (2 * 20) + (16 + 4 + 20) (112) hal value 362 cck_eifs = 10 + (10 + (2 * 20) + (144 + 48 + 112) (364) hal value 362 --------------------------------------------------------------------------------------- size to time calculation per mode and rate: howmany (x+(y-1))/y cck: kbps {1000,2000,5500,11000} txtime = (framebits * 1000) / kbps ofdm: kbps {6000,9000,12000,24000,36000,48000,54000} OFDM_SYMBOL_TIME_FULL = 4 OFDM_SYMBOL_TIME_HALF = 8 OFDM_SYMBOL_TIME_QUARTER = 16 bitspersymbol = (kbps * OFDM_SYMBOL_TIME) / 1000 numsymbols = howmany(framebits, bitspersymbol) txtime = numsymbols * OFDM_SYMBOL_TIME --------------------------------------------------------------------------------------- default eifs from hal ini array per mode: { 0x000010b0, 0x00000e60, 0x00001180, 0x00001f1c, 0x00003e38, 0x00001180 } /* 11a Turbo 11b 11g 108g */ static const uint8_t CLOCK_RATE[] = { 40, 80, 22, 44, 88 }; mode b (3) 0x1f1c 362 mode pure g (4) 0x3e38 362 mode a (1) 0xe60 92 mode t (2) 0x1180 56 mode 108g (5) 0x1180 50.9 --------------------------------------------------------------------------------------- default sifs from hal ini array per mode: { 0x00001030, 0x00000230, 0x000001e0, 0x000000b0, 0x00000160, 0x000001e0 }, /* 11a Turbo 11b 11g 108g */ static const uint8_t CLOCK_RATE[] = { 40, 80, 22, 44, 88 }; mode b (3) 0xb0 8 (10) mode pure g (4) 0x160 8 (10) mode a (1) 0x230 14 (16) mode t (2) 0x1e0 6 (8) mode 108g (5) 0x1e0 5.4 (8) --------------------------------------------------------------------------------------- default slottime from hal ini array per mode: { 0x00001070, 0x00000168, 0x000001e0, 0x000001b8, 0x0000018c, 0x000001e0 }, /* 11a Turbo 11b 11g 108g */ static const uint8_t CLOCK_RATE[] = { 40, 80, 22, 44, 88 }; mode b (3) 0x1b8 20 mode pure g (4) 0x18c 9 mode a (1) 0x168 9 mode t (2) 0x1e0 6 mode 108g (5) 0x1e0 5.4 slottime from hal ini array per mode: --------------------------------------------------------------------------------------- default acktimeout from hal ini array per mode: { 0x00008014, 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 }, /* 11a Turbo 11b 11g 108g */ static const uint8_t CLOCK_RATE[] = { 40, 80, 22, 44, 88 }; mode b (3) 0x420 48 mode pure g (4) 0x840 48 mode a (1) 0x3E8 25 mode t (2) 0x6E0 22.1 mode 108g (5) 0x6E0 20.09 --------------------------------------------------------------------------------------- ar5212_misc.c : /* Setup coverage class */ void ar5212SetCoverageClass(struct ath_hal *ah, uint8_t coverageclass, int now) { uint32_t slot, timeout, eifs; u_int clkRate; AH_PRIVATE(ah)->ah_coverageClass = coverageclass; if (now) { if (AH_PRIVATE(ah)->ah_coverageClass == 0) return; /* Don't apply coverage class to non A channels */ if (!IS_CHAN_A(AH_PRIVATE(ah)->ah_curchan)) return; /* Get core clock rate */ clkRate = ath_hal_mac_clks(ah, 1); /* Compute EIFS */ slot = coverageclass * 3 * clkRate; eifs = coverageclass * 6 * clkRate; if (IS_CHAN_HALF_RATE(AH_PRIVATE(ah)->ah_curchan)) { slot += IFS_SLOT_HALF_RATE; eifs += IFS_EIFS_HALF_RATE; } else if (IS_CHAN_QUARTER_RATE(AH_PRIVATE(ah)->ah_curchan)) { slot += IFS_SLOT_QUARTER_RATE; eifs += IFS_EIFS_QUARTER_RATE; } else { /* full rate */ slot += IFS_SLOT_FULL_RATE; eifs += IFS_EIFS_FULL_RATE; } /* * Add additional time for air propagation for ACK and CTS * timeouts. This value is in core clocks. */ timeout = ACK_CTS_TIMEOUT_11A + (coverageclass * 3 * clkRate); /* * Write the values: slot, eifs, ack/cts timeouts. */ OS_REG_WRITE(ah, AR_D_GBL_IFS_SLOT, slot); OS_REG_WRITE(ah, AR_D_GBL_IFS_EIFS, eifs); OS_REG_WRITE(ah, AR_TIME_OUT, SM(timeout, AR_TIME_OUT_CTS) | SM(timeout, AR_TIME_OUT_ACK)); } } --------------------------------------------------------------------------------------- ar5212.h : #define IFS_SLOT_FULL_RATE 0x168 /* 9 us half, 40 MHz core clock (9*40) */ #define IFS_SLOT_HALF_RATE 0x104 /* 13 us half, 20 MHz core clock (13*20) */ #define IFS_SLOT_QUARTER_RATE 0xD2 /* 21 us quarter, 10 MHz core clock (21*10) */ #define IFS_EIFS_FULL_RATE 0xE60 /* (74 + (2 * 9)) * 40MHz core clock */ #define IFS_EIFS_HALF_RATE 0xDAC /* (149 + (2 * 13)) * 20MHz core clock */ #define IFS_EIFS_QUARTER_RATE 0xD48 /* (298 + (2 * 21)) * 10MHz core clock */ #define ACK_CTS_TIMEOUT_11A 0x3E8 /* ACK timeout in 11a core clocks */ --------------------------------------------------------------------------------------- http://www.winlab.rutgers.edu/~zhibinwu/html/wlan_back.htm : aSIFSTime and aSlotTime are fixed per PHY. aSIFSTime is: aRxRFDelay + aRxPLCPDelay + aMACProcessingDelay + aRxTxTurnaroundTime. aSlotTime is: aCCATime + aRxTxTurnaroundTime + aAirPropagationTime + aMACProcessingDelay. The PIFS and DIFS are derived by the following equations, as illustrated in Figure 58. PIFS = aSIFSTime + aSlotTime DIFS = aSIFSTime + 2xaSlotTime The EIFS is derived from the SIFS and the DIFS and the length of time it takes to transmit an ACK Control frame at 1 Mbit/s by the following equation: EIFS = aSIFSTime + (8xACKSize) + aPreambleLength + aPLCPHeaderLngth + DIFS --------------------------------------------------------------------------------------- http://forums.wi-fiplanet.com/showthread.php?t=6176 : EIFS is the longest of the interframe spaces. A PIFS is equal to a SIFS + Slot Time (Slot Times are defined for each PHY). A DIFS equals a SIFS + 2 Slot Times. The formula to calculate an EIFS is much longer but it includes a SIFS and a DIFS. From 802.11-1999 "The EIFS is derived from the SIFS and the DIFS and the length of time it takes to transmit an ACK frame at 1 Mbit/s by the following equation: EIFS = aSIFSTime + (8 x ACKSize) + aPreambleLength + aPLCPHeaderLngth + DIFS EIFS is used in DCF after a station senses an idle medium following reception of an erroneous frame- one in which the MAC frame is incomplete or the MAC frame has an incorrect FCS. The EIFS allows enough time for another station to acknowledge the frame (it may have been received correctly at the intended station) before this station begins transmission. -- Actually the EIFS is an issue of a third party STA (Say C), here is the scenario: B ---------- A ----------- C , where C does not hear B, now suppose the following scenario: 1- A sends a frame to B 2- C receives the frame with an error (it might be interference at C) 3- B receives correctly the frame 4- B starts sending the Ack, C does not hear it 5- C senses an idle channel, so it might start sending its frame to A. ===> Collision between C's frame and B's Ack. Solution, Make C wait more than a DIFS to give more time and chance to B's Ack to get to A correctly, the new time is called EIFS. --------------------------------------------------------------------------------------- IEEE 802.11-2007 9.2.10 : aSIFSTime and aSlotTime are fixed per PHY. aSIFSTime is: aRxRFDelay + aRxPLCPDelay + aMACProcessingDelay + aRxTxTurnaroundTime. aSlotTime is: aCCATime + aRxTxTurnaroundTime + aAirPropagationTime + aMACProcessingDelay. The PIFS and DIFS are derived by the following equations, as illustrated in Figure 9-12. PIFS = aSIFSTime + aSlotTime DIFS = aSIFSTime + 2 × aSlotTime The EIFS is derived from the SIFS and the DIFS and the length of time it takes to transmit an ACK Control frame at the lowest PHY mandatory rate by the following equation: EIFS = aSIFSTime + DIFS + ACKTxTime where ACKTxTime is the time expressed in microseconds required to transmit an ACK frame, including preamble, PLCP header and any additional PHY dependent information, at the lowest PHY mandatory rate. --------------------------------------------------------------------------------------- http://www.csie.ntu.edu.tw/~d92005/Wireless%20Networks/2CSMA_CA.pdf : EIFS = aSIFSTime + (8×ACKsize) + aPreambleLength + PLCPHeaderLength + DIFS where ACKsize is computed based on 1Mbps data rate. --------------------------------------------------------------------------------------- http://www.air-stream.org.au/ACK_Timeouts : In 802.11b, the constants are mandated by IEEE as follows: * Slottime = 20 µs * SIFS = 10 µs * PIFS = SIFS + Slottime = 30 µs * DIFS = SIFS + 2 x Slottime = 50 µs In 802.11g: * Slottime = 9 µs * SIFS = 10 µs * DIFS = SIFS + 2 x Slottime = 28 µs In 802.11a: * Slottime = 9 µs * SIFS = 16 µs * DIFS = SIFS + 2 x Slottime = 34 µs -- ACK Timeout = Air Propagation Time (max) + SIFS + Time to transmit 14 byte ACK frame [14 * 8 / bitrate in Mbps] + Air Propagation Time (max) Slottime = MAC and PHY delays + Air Propagation Time (max) DIFS = SIFS + 2 * Slottime